package com.ssy.lingxi.member.merchant.model.vo.basic.response;

import com.ssy.lingxi.member.merchant.model.constant.MemberOuterStatusEnum;
import com.ssy.lingxi.member.merchant.api.constant.MemberRelationTypeEnum;
import com.ssy.lingxi.member.merchant.model.constant.MemberStringEnum;
import com.ssy.lingxi.member.merchant.model.constant.MemberValidateHistoryOperationEnum;
import com.ssy.lingxi.member.merchant.utils.NumberUtil;
import org.springframework.util.StringUtils;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * 日志中心 - 查询外部历史记录返回
 * @author 万宁
 * @version 2.0.0
 * @date 2021-12-03
 */
public class MemberOuterHitoryDetailVO implements Serializable {
    private static final long serialVersionUID = 1190799150608804105L;

    public MemberOuterHitoryDetailVO(Long memberId, Long subMemberId, Integer relType, LocalDateTime createTime, String roleName, Integer outerStatus, Integer operationCode, String operation, String remark) {
        this.memberId = relType == null ? subMemberId : (relType.equals(MemberRelationTypeEnum.PLATFORM.getCode()) ? subMemberId : memberId);
        this.createTime = createTime == null ? "" : createTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
        this.operateType = relType == null ? "" : (relType.equals(MemberRelationTypeEnum.PLATFORM.getCode()) ? MemberStringEnum.PLATFORM_BACKGROUND.getName() : MemberStringEnum.MEMBER_CENTRE.getName());
        this.roleName = roleName;
        this.statusName = MemberOuterStatusEnum.getCodeMsg(outerStatus);
        this.operation = NumberUtil.isNullOrZero(operationCode) ? operation : MemberValidateHistoryOperationEnum.getMsgByCode(operationCode);
        this.remark = StringUtils.hasLength(remark) ? remark : "";
    }

    /**
     * 会员Id
     */
    private Long memberId;

    /**
     * 操作时间，格式为yyyy-MM-dd HH:mm
     */
    private String createTime;

    /**
     * 操作类型
     */
    private String operateType;

    /**
     * 操作角色
     */
    private String roleName;

    /**
     * 状态名称
     */
    private String statusName;

    /**
     * 操作
     */
    private String operation;

    /**
     * 备注说明
     */
    private String remark;

    public Long getMemberId() {
        return memberId;
    }

    public void setMemberId(Long memberId) {
        this.memberId = memberId;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getOperateType() {
        return operateType;
    }

    public void setOperateType(String operateType) {
        this.operateType = operateType;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public String getStatusName() {
        return statusName;
    }

    public void setStatusName(String statusName) {
        this.statusName = statusName;
    }

    public String getOperation() {
        return operation;
    }

    public void setOperation(String operation) {
        this.operation = operation;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
}
